package operation;

import book.BookList;
import java.util.Scanner;

public class FindOperation implements IOPeration{
    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("查找图书！！");
        System.out.println("请输入所查找的书名：--》");
        String name = scanner.nextLine();
        int pos = bookList.books.indexOf(name);
        if (pos == -1) {
            System.out.println("没有找到您要查找的图书！！");
            return;
        }
        System.out.println("所查找图书信息如下：");
        System.out.println(bookList.books.get(pos));
        return;
    }
}
